import { api } from "@/lib/api"; import { fmtInt, fmtMw } from "@/lib/format"; import { OG_CONTENT_TYPE, OG_SIZE, renderOg } from "@/lib/og-template"; export const alt = "Data centers by country on DataCenterIndex"; export const size = OG_SIZE; export const contentType = OG_CONTENT_TYPE; export const revalidate = 3600; export default async function Image({ params }: { params: Promise<{ slug: string }> }) { const { slug } = await params; const r = await api.country(slug); if (!r.ok) return renderOg({ eyebrow: "Country", title: `Data centers in ${slug.replace(/-/g, " ")}`, subtitle: "Facilities, capacity, operators, cloud regions and projects." }); const c = r.data; const pipe = c.constructionMw === null && c.plannedMw === null ? null : (c.constructionMw ?? 0) + (c.plannedMw ?? 0); return renderOg({ eyebrow: `Country · ${c.iso2}`, title: `Data centers in ${c.name}`, subtitle: [c.region, `${fmtInt(c.operatorCount)} operators`, `${fmtInt(c.hyperscaleCount)} hyperscale`].filter(Boolean).join(" · "), stats: [ { label: "Facilities", value: fmtInt(c.facilityCount) }, { label: "Operational MW", value: c.knownMw ? fmtMw(c.knownMw) : "—" }, { label: "Pipeline", value: pipe ? `≈ ${fmtMw(pipe)}` : "—" }, { label: "Cloud regions", value: fmtInt(c.cloudRegionCount) }, ], }); }